package com.kim.resource.client.config;

import lombok.Data;
import org.apache.commons.collections4.MapUtils;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.List;
import java.util.Map;

/**
 * SurgeOauth2Properties
 */
@Data
@ConfigurationProperties(SurgeOauth2Properties.PREFIX)
public class SurgeOauth2Properties {

    /**
     * 认证配置前缀{@value}
     */
    public final static String PREFIX = "surge.oauth2.token-store";

    /**
     * 客户端名称
     */
    private String client;

    /**
     * TokenStore类型
     */
    private String type;

    /**
     * 动态权限是否开启
     */
    private boolean enableDynamicAuth;

    /**
     * 动态Scope是否开启
     */
    private boolean enableDynamicScopeAuth;

    /**
     * Scope规则
     */
    private Map<String, List<String>> scopeRule;
    
    /**
     * Scope规则是否存在
     */
    boolean scopeRuleIsExist(){
        return MapUtils.isNotEmpty(scopeRule);
    }
}
